<template>
	<view>
		<f-signature @getImg="getImg"></f-signature>
	</view>
</template>

<script>
	import {
		uploadBase64Image
	} from "@/api/my.js";
	import fSignature from '@/uni_modules/f-signature/components/f-signature/f-signature.vue';
	export default {
		components: {
			fSignature
		},
		data() {
			return {
				sign: '',
				train_id:''
			}
		},
		onLoad(option) {
			this.train_id = option.train_id
		},
		methods: {
			getImg(e) {
				
				this.agree(e)
				// uni.navigateBack();
			},
			async agree(e){
				
				let data = {
					'base64_image': e,
					'train_id':this.train_id
				}
				console.log('保存签名',data);
				let res = await uploadBase64Image(data).then(res => {
					console.log(res,'8888888888');
					if(res.code == 1){
						uni.showToast({
							'icon':'none',
							'title':res.msg,
							'duration':1500
						})
						uni.$emit('isRefresh', res.data)
						setTimeout(function() {
						  uni.navigateBack()
						}, 1500);
					}
				});
			},
			//调用	
			async uploadFile(e) {
				
			},
		}
	}
</script>

<style></style>